from django.contrib import admin
from django.urls import path, re_path

from urldemo import views

urlpatterns = [
    path('index/', views.index),
    # 【一】路由转换器
    path('articles/2022/', views.special_case_2022),
    path('articles/<int:year>/', views.year_archive),
    # path('articles/<int:year>/<int:month>/', views.month_archive),
    # path('articles/<int:year>/<int:month>/<slug:slug>/', views.article_detail),
    # # slug类型
    # path('articles/<slug:title>/', views.articles_slug),
    # # str类型
    # path('articles/<str:city>/', views.articles_str),
    # # path类型
    # path('articles/<path:path>/', views.articles_path),

    # 【二】正则方式匹配
    # re_path('articles/2021/$', views.re_special_case_2021),
    # re_path('articles/(?P<year>[0-9]{4})/$', views.re_year_archive),
    # re_path('articles/(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/$', views.re_month_archive),
    # re_path('articles/(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/(?P<slug>[-_\w]+)/$', views.re_article_detail),
    #
    # # 【三】 传递额外参数
    # # path('blog/<int:year>/', views.blog_year_archive, {'major': 'python'}),
    # re_path('blog/(?P<year>[0-9]{4})/$', views.blog_year_archive, {'major':'python','info':"django"}),

]
